package com.scienview.core.util;

public class StringUtil {
	
	/** 
	 * 判断字符串是否为空
	 *  */
	public static boolean isNull(Object value) {
		return value == null;
	}
	
	/** 
	 * 判断字符串是否为空
	 **/
	public static boolean isNotNull(Object value) {
		return value != null ;
	}
	
	/**
	 * 是否为空
	 * @param value
	 * @return
	 */
	public static boolean isEmpty(Object value){
		if(value instanceof String){
			 return value == null || value.equals("")||((String)value).trim().equals("");
		}
		return value==null;
	}
	
	/**
	 * 是否不为空
	 * @param value
	 * @return
	 */
	public static boolean isNotEmpty(Object value){
		return !isEmpty(value);
	}
	
	public static Object trim(Object value){
		if(value instanceof String){
			value=((String)value).trim();
		}
		return value;
	}

	public static String getLastAfter(String resource,String prex){
		int index=resource.lastIndexOf(prex);
		if(index==-1)return resource;
		return resource.substring(index+prex.length());
	}
	
	public static String getLastBefore(String resource,String suix){
		int index=resource.lastIndexOf(suix);
		if(index==-1)return resource;
		return resource.substring(0,index);
	}
}
